package day07;

import java.util.Scanner;

public class CalAirPrice {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("输入机票价格");
        double price = scan.nextInt();
        System.out.println("输入月份");
        int month = scan.nextInt();
        System.out.println("请选择仓位：1.头等舱 2.商务舱 3.经济舱");
        int type = scan.nextInt();
        double finalPrice = calAirPrice(price, month, type);
        if (finalPrice!=-1){//数据合理
            System.out.println("机票的最终价格为：" + finalPrice);
        }
    }
    public static double calAirPrice(double price, int month, int type) {
        double finalPrice = 0.0;
        if (month < 1 || month > 12) {
            System.out.println("月份输入错误");
            return -1;
        }
        if (type < 1 || type > 3) {
            System.out.println("舱位输入错误");
            return -1;
        }
        if (month >= 5 && month <= 10) {//月份 旺季
            switch (type) {
                case 1:
                    finalPrice = price * 0.9;
                case 2:
                    finalPrice = price * 0.85;
                case 3:
                    finalPrice = price * 0.7;
            }
        } else {    //淡季
            switch (type) {
                case 1:
                    finalPrice = price * 0.8;
                case 2:
                    finalPrice = price * 0.7;
                case 3:
                    finalPrice = price * 0.6;
            }
        }
        return finalPrice;
    }
}
